package com.action.login;

import java.util.Map; 

import org.apache.struts2.interceptor.SessionAware;

import com.opensymphony.xwork2.ActionSupport;

/**
 * <p>
 * Title:
 * </p>
 * 
 * <p>
 * Description:
 * </p>
 * 
 * <p>
 * Copyright: Copyright (c) 2008
 * </p>
 * 
 * <p>
 * Company:
 * </p>
 * 
 * @author not attributable
 * @version 1.0
 */
public class LogoutAction extends ActionSupport implements SessionAware {
	public LogoutAction() {
	}

	private Map session;

	public void setSession(Map session) {

		this.session = session;
	}

	// javax.servlet.http.HttpSession sessions=request.getSession();

	public String execute() throws Exception {

		Object sessionbean = session;
		// Object sessionbean=request.getSession().getAttribute("linkSession");
		if (sessionbean == null) {
			return SUCCESS;
			// return mapping.findForward("sessionlost_login");
		} else {
			//session = null;
			session.remove("USER_NAME");
			return "fail";
			// request.getSession().removeAttribute("linkSession");
			// return mapping.findForward("globallogin");
		}
		// return SUCCESS;
	}

}
